package com.ysd.lis.controller.lab;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabProcessAttribute;
import com.ysd.lis.request.DeleteParam;
import com.ysd.lis.service.lab.LabProcessAttributeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bai
 * @since 2024-02-20
 */
@RestController
@RequestMapping("/lab/process/attribute")
public class LabProcessAttributeController extends BaseController {

    @Autowired
    LabProcessAttributeService processAttributeService;

    //获取流程节点信息列表
    @ApiOperation("获取流程节点属性信息列表（不分页)")
    @GetMapping("/getProcessAttributeList")
    public Result getProcessAttributeList(LabProcessAttribute labProcessAttribute) {
        return processAttributeService.getProcessAttributeList(labProcessAttribute);
    }

    //获取流程节点信息列表
    @ApiOperation("根据节点code获取流程节点属性信息列表（不分页)")
    @GetMapping("/getProcessAttributeListByCode")
    public Result getProcessAttributeListByCode(String  code) {
        return processAttributeService.getProcessAttributeListByCode(code);
    }

    @ApiOperation("删除标本流程节点属性信息")
    @PostMapping("/daleteProcessAttribute")
    @LogDetail(requestParam = "daleteProcessAttribute", operationType = OperationType.DELETE, module = "条码管理", content = "通过检验模块，使用流程设置功能删除了：【name】流程节点下的【names】属性")
    public Result daleteProcessAttribute(@RequestBody DeleteParam deleteParam) {
        return processAttributeService.daleteProcessAttribute(deleteParam);
    }

    @ApiOperation("修改标本流程节点信息")
    @PostMapping("/updateProcessAttribute")
    @LogDetail(requestParam = "updateProcessAttribute", operationType = OperationType.UPDATE, module = "条码管理", content = "通过检验模块，使用流程设置功能修改了：【nodeName】流程节点下的【processAttName】属性")
    public Result updateProcessAttribute(@RequestBody LabProcessAttribute labProcessAttribute) {
        return processAttributeService.updateProcessAttribute(labProcessAttribute);
    }

    //新增
    @ApiOperation("新增标本流程节点")
    @PostMapping("/addProcessAttribute")
    @LogDetail(requestParam = "addProcessAttribute", operationType = OperationType.INSERT, module = "条码管理", content = "通过检验模块，使用流程设置功能新增了：【nodeName】流程节点下的【processAttName】属性")
    public Result addProcessAttribute(@RequestBody LabProcessAttribute labProcessAttribute) {
        return processAttributeService.addProcessAttribute(labProcessAttribute);
    }

}
